Skip to content

Conversation

@wojtekn
Copy link
Contributor

@wojtekn wojtekn commented Jan 15, 2026

Summary

Fixes #300 - Support for DEFAULT (now()) and other function calls wrapped in parentheses in CREATE TABLE statements.

Problem

The MySQL 8.0 syntax DEFAULT (function()) was failing because the translator only consumed a single token after the DEFAULT keyword. For expressions like DEFAULT (now()), it would only capture the opening parenthesis (, causing the query translation to fail.

Solution

Enhanced the DEFAULT clause handler in WP_SQLite_Translator to:

  • Detect when a DEFAULT value starts with an opening parenthesis
  • Track parenthesis depth to consume the complete expression
  • Handle nested parentheses correctly

@wojtekn wojtekn force-pushed the fix/function-calls-in-parentheses branch from bdb6127 to a1fa523 Compare January 15, 2026 10:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create table with DEFAULT (now()) fails in AST driver

1 participant